package dexter.core.common;

import dexter.net.msg.common.RequestParams;
import dexter.testing.EvaluationValues;
import dexter.util.PublicIp;


public class FinishParams implements RequestParams {

	private static final long serialVersionUID = -7842357671693022874L;
	
	private String groupId;
	private String jobId;
    private EvaluationValues localResult;
    private String sourceIp;
    private boolean remote;
    
    private String classname;
    private byte[] classbytes;
	
    //LOCAL MODE
	public FinishParams(String groupId, String jobId, String ip, EvaluationValues localResult, String classname, byte[] classbytes) {
		this.groupId = groupId;
		this.jobId = jobId;
		this.localResult = localResult;
		this.sourceIp = ip;
		this.remote = false;
		this.classname = classname;
		this.classbytes = classbytes;
	}
	
	//REMOTE MODE
	public FinishParams(String groupId, String jobId, String ip, String classname, byte[] classbytes) {
		this.groupId = groupId;
		this.jobId = jobId;
		this.sourceIp = ip;
		this.remote = true;
		this.classname = classname;
		this.classbytes = classbytes;
	}
   
    public String getJobId() {
		return jobId;
	}

	public EvaluationValues getLocalResult() {
		return localResult;
	}
	
	 
	public String getSourceIp() {
			return sourceIp;
	}
	
	public boolean isRemote() {
		return remote;
	}
	
    public String toString() {
    	String type = "local";
    	if (remote) type = "remote"; 
    	return type+" test : job ("+jobId+") from "+sourceIp;
    }

	public String getClassName() {
		return classname;
	}

	public byte[] getClassBytes() {
		return classbytes;
	}

	public String getGroupId() {
		return groupId;
	}


}